<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script>
        let arr = [1,2,3,4,5,6]
        function max(arr) {
            let max = 0;
            for (let i = 0; i <arr.length ; i++) {
                if(max < arr[i]){
                    max = arr[i]
                }
            }
            return max;
        }
         var max = max(arr);
        alert(max);


    </script>

</head>
<body>

</body>
</html>